home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / jockguts.arc / IOTTT5.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-28  |  62KB  |  1,818 lines

  1. {--------------------------------------------------------------------------}
  2. {                         TechnoJock's Turbo Toolkit                       }
  3. {                                                                          }
  4. {                              Version   5.01                              }
  5. {                                                                          }
  6. {                                                                          }
  7. {              Copyright 1986, 1989 TechnoJock Software, Inc.              }
  8. {                           All Rights Reserved                            }
  9. {                          Restricted by License                           }
  10. {--------------------------------------------------------------------------}
  11.  
  12.                      {--------------------------------}
  13.                      {       Unit:    IOTTT5          }
  14.                      {--------------------------------}
  15.  
  16. {Change history:  2/24/89 5.00a    Added default Jump_Full setting line 900
  17.                   2/26/89 5.00b    Added exit statement line 1339
  18.                   2/28/89 5.00c    Modified insert proc line 1497
  19.                           5.00d    Expanded Display_All_Fields line 1188
  20.                   3/05/89 5.00e    Changed default Allow_Esc to true
  21.                           5.00f    Reduced size of Table Settings structure
  22.                   3/12/89 5.00g    Added cursor keys etc. to Allow_Char logic
  23.                                    lines 226 & 1568
  24.                           5.00h    Modified field rules logic to permit
  25.                                    Field_Rules to be called before XXX_Field
  26.                                    e.g. Real_Field
  27.                           5.00i    Changed Cursor positioning logic for
  28.                                    fields  line 593, 1315, 1331
  29.                           5.00j    Improved insert procedure and added proc
  30.                                    Init_Insert_Mode;
  31.                           5.00k    Corrected Refresh_Fields bug in non IOFULL
  32.                                    state.
  33.                           5.00l    Changed Erase_Default logic to work when
  34.                                    jumping
  35.                           5.00m    Added Enter Field Hook for first field
  36.             April 1, 89   5.01     Added error checking for TableSet,
  37.                                    and changed error level on fatal
  38. }
  39.  
  40.  
  41. {$S-,R-,V-}
  42.  
  43. Unit IOTTT5;
  44.  
  45. (*
  46. {$DEFINE IOFULL}
  47. *)
  48.  
  49. INTERFACE
  50.  
  51. uses CRT, FastTTT5, DOS, WinTTT5, KeyTTT5, StrnTTT5, MiscTTT5;
  52.  
  53. CONST
  54. MaxTables      = 10;       {alter as necessary}
  55. MaxInputFields = 40;       {alter as necessary}
  56.  
  57. IOUndefined = 0;
  58. {$IFDEF IOFULL}
  59. IOString   = 1;
  60. IOByte     = 2;
  61. IOWord     = 3;
  62. IOInteger  = 4;
  63. IOLongInt  = 5;
  64. IOReal     = 6;
  65. IOPassword = 7;
  66. IOSelect   = 8;
  67. IODate     = 9;
  68.  
  69. AllowNull    = $01;
  70. SuppressZero = $02;
  71. RightJustify = $04;
  72. EraseDefault = $08;
  73. JumpIfFull   = $10;
  74.  
  75. Default_Allow_Null    :boolean = true;
  76. Default_Suppress_Zero :boolean = true;
  77. Default_Right_Justify :boolean = false;
  78. Default_Erase_Default :boolean = false;
  79. Default_Jump_Full     :boolean = false;
  80. Default_Allow_Char    :set of char = [#0];
  81. Default_DisAllow_Char :set of char = [#0];
  82. {$ENDIF}
  83. Refresh_None    = 0;
  84. Refresh_Current = 1;
  85. Refresh_All     = 2;
  86. End_Input       = 99;
  87. No_Char         = #0;
  88.  
  89. TYPE
  90. {$IFDEF VER50}
  91. Move_Field_Proc = procedure(var CurrentField:byte;var Refresh:byte);
  92. Char_Hook_Proc   = procedure(var Ch : char; var CurrentField:byte;var Refresh:byte);
  93. Insert_Proc      = procedure(Insert:boolean);
  94. {$ENDIF}
  95.  
  96. IOCharSet = Set of char;
  97. Str_Field_Defn = record
  98.                       Upfield   : byte;
  99.                       Downfield : byte;
  100.                       Leftfield : byte;
  101.                       Rightfield: byte;
  102.                       X         : byte;
  103.                       Y         : byte;
  104.                       Message   : strscreen;        {5.00f}
  105.                       MsgX      : byte;
  106.                       MsgY      : byte;
  107.                       CursorX   : byte;
  108.                       StrLocX   : byte;
  109.                       FieldLen  : byte;
  110.                       FieldStr  : strscreen;
  111.                       FieldFmt    : strscreen;       {5.00f}
  112.                       Right_Justify : boolean;
  113.                       {$IFDEF IOFULL}
  114.                       RealDP        : byte;
  115.                       Allow_Null    : boolean;
  116.                       Suppress_Zero : Boolean;
  117.                       Erase_Default : boolean;
  118.                       Jump_Full     : boolean;
  119.                       Allow_Char    : set of char;
  120.                       DisAllow_Char : set of char;
  121.                       Rules_Set     : Boolean;    {5.00h}
  122.                       case FieldType:byte of
  123.                            IOString   : (SPtr: ^string);
  124.                            IOByte     : (BPtr: ^Byte;BMax:byte;BMin:byte);
  125.                            IOWord     : (WPtr: ^Word;WMax:word;WMin:word);
  126.                            IOInteger  : (IPtr: ^Integer;IMax:integer;IMin:Integer);
  127.                            IOLongInt  : (LPtr: ^LongInt;LMax:longint;LMin:longInt);
  128.                            IOReal     : (RPtr: ^Real;RMax:real;RMin:Real);
  129.                            IODate     : (DPtr: ^Dates;DFormat:byte;DMax:Dates;DMin:Dates);
  130.                       {$ELSE}
  131.                       FieldType : byte;
  132.                       SPtr : ^string;
  133.                       {$ENDIF}
  134.                 end;
  135.  
  136. Str_Field_Ptr = ^Str_Field_Defn;
  137.  
  138. TableSettings = record
  139.                      HiFCol  : byte;
  140.                      HiBCol  : byte;
  141.                      LoFCol  : byte;
  142.                      LoBCol  : byte;
  143.                      MsgFCol : byte;
  144.                      MsgBCol : byte;
  145.                      TotalFields: byte;
  146.                      CurrentField : byte;
  147.                      AllowEsc : boolean;
  148.                      IO_FieldsSet : boolean;
  149.                      Displayed   : boolean;
  150.                      Beep : boolean;
  151.                      WhiteSpace : char;
  152.                      ErrorLine : byte;
  153.                      Insert : boolean;
  154.                      {$IFDEF VER50}
  155.                      LeaveFieldHook : Move_Field_Proc;
  156.                      EnterFieldHook : Move_Field_Proc;
  157.                      CharHook   : Char_Hook_Proc;
  158.                      InsertProc : Insert_Proc;
  159.                      {$ENDIF}
  160.                      FinishChar : char;
  161.                 end;
  162.  
  163. TableRec = record
  164.                 FieldDefn: array[0..MaxInputFields] of Str_Field_Ptr;
  165.                 ITTT: TableSettings;
  166.            end;
  167.  
  168. TablePtr = ^TableRec;
  169.  
  170.  
  171. VAR
  172.   CurrentTable : byte;
  173.   TableSet: boolean;
  174.   TotalTables : byte;
  175.   Table : array[1..MaxTables] of TablePtr;
  176.   I_Char : char;
  177.   {$IFNDEF VER50}
  178.   IO_LeaveHook,
  179.   IO_EnterHook,
  180.   IO_CharHook,
  181.   IO_InsertHook : pointer;
  182.   {$ENDIF}
  183.  
  184. Procedure Create_Tables(No_Of_Tables:byte);
  185. Procedure Activate_Table(Table_no:byte);
  186. {$IFDEF VER50}
  187. Procedure Assign_LeaveFieldHook(Proc:Move_Field_Proc);
  188. Procedure Assign_EnterFieldHook(Proc:Move_Field_Proc);
  189. Procedure Assign_CharHook(Proc:Char_Hook_Proc);
  190. Procedure Assign_InsHook(Proc:Insert_Proc);
  191. {$ENDIF}
  192. Procedure Create_Fields(No_of_fields:byte);
  193. Procedure Define_Colors(HiF,HiB,LoF,LoB,MsgF,MsgB:byte);
  194. Procedure Add_Message(DefID,DefX,DefY : byte; DefString : string);
  195. Procedure Add_Field(DefID,DefU,DefD,DefL,DefR,DefX,DefY:byte);
  196. Procedure String_Field(DefID:byte;var Strvar:String;DefFormat:string);
  197. {$IFDEF IOFULL}
  198. Procedure Assign_Finish_Char(Ch : char);
  199. Procedure Byte_Field(DefID:byte;var ByteVar:Byte;DefFormat:string;Min,Max:byte);
  200. Procedure Word_Field(DefID:byte;var Wordvar:Word;DefFormat:string;Min,Max:word);
  201. Procedure Integer_Field(DefID:byte;var Integervar:Integer;DefFormat:string;Min,Max:integer);
  202. Procedure LongInt_Field(DefID:byte;var LongIntvar:LongInt;DefFormat:string;Min,Max:LongInt);
  203. Procedure Date_Field(DefID:byte;var Datevar:Dates;DateFormat:byte;DefFormat:string;
  204.                       Min,Max : Dates);
  205. Procedure Real_Field(DefID:byte;var Realvar:Real;DefFormat:string;Min,Max:real);
  206. Procedure Set_Default_Rules(Rules:word);
  207. Procedure Field_Rules(DefID:byte;Rules:word;AChar:IOcharset;DChar:IOcharset);
  208. {$ENDIF}
  209. Procedure Display_All_Fields;
  210. Procedure Allow_Esc(OK:boolean);
  211. Procedure Allow_Beep(OK:boolean);
  212. Procedure Init_Insert_Mode(ON:boolean);         {5.00j}
  213. Procedure Dispose_Fields;
  214. Procedure Dispose_Tables;
  215. Procedure Process_Input(StartField:byte);
  216.  
  217. implementation
  218.  
  219. Const
  220.     Valid    = 0;
  221.     NotValid = 1;
  222.     EscValid = 2;
  223.  
  224.     FmtChars  : set of char = ['!','#','@','*'];
  225.     IOUp       = #200;
  226.     IODown     = #208;
  227.     IORight    = #205;
  228.     IOLeft     = #203;
  229.     IODel      = #211;
  230.     IOTotErase = #146;    {Alt-E}
  231.     IOErase    = #160;    {Alt-D}
  232.     IOFinish   = #196;    {F10}   {can be over ridden with ASSIGN_FINISH_CHAR}
  233.     IOEsc      = #27;
  234.     IOTab      = #9;
  235.     IOShiftTab = #143;
  236.     IOEnter    = #13;
  237.     IOIns      = #210;
  238.     IOBackSp   = #8;
  239.     IORightFld = #244;
  240.     IOLeftFld  = #243;
  241.     Control_Char : set of char = [IOUp,IODown,IORight,IOLeft,IODel,    {5.00g}
  242.                                   IOTotErase,IOErase, IOEsc,
  243.                                   IOTab, IOShiftTab, IOEnter, IOIns,
  244.                                   IOBackSp, IORightFld, IOLeftFld];
  245. VAR
  246.    FirstCharPress : boolean;
  247.  
  248. {$F+}
  249. procedure NoFieldHook(var CurrentField:byte;var Refresh:byte);
  250. begin
  251. end;
  252.  
  253. procedure NoCharHook(var Ch : char; var CurrentField:byte;var Refresh:byte);
  254. begin
  255. end;
  256.  
  257. Procedure DefaultInsertHook(On:boolean);
  258. begin
  259.     If ON then
  260.        OnCursor
  261.     else
  262.        FullCursor;
  263. end;
  264. {$F-}
  265.  
  266. {$IFNDEF VER50}
  267. Procedure CallEnterFieldHook(var CurrentField:byte;var Refresh:byte);
  268.           Inline($FF/$1E/IO_EnterHook);
  269.  
  270. Procedure CallLeaveFieldHook(var CurrentField:byte;var Refresh:byte);
  271.           Inline($FF/$1E/IO_LeaveHook);
  272.  
  273. Procedure CallCharHook(var Ch : char; var CurrentField:byte;var Refresh:byte);
  274.           Inline($FF/$1E/IO_CharHook);
  275.  
  276. Procedure CallInsertHook(On:boolean);
  277.           Inline($FF/$1E/IO_InsertHook);
  278. {$ENDIF}
  279.  
  280. Procedure IOTTT_Error(Code:byte;value:real);    {fatal error -- msg and halt}
  281. var Message:string;
  282. begin
  283.     Case Code of
  284.     1 : Message := 'Error 1: Invalid value of '+Real_to_Str(value,0)
  285.                    +' in Create_Fields with a MaxInputFields of '
  286.                    +Real_to_Str(MaxInputFields,0);
  287.     2 : Message := 'Error 2 : Insufficient Memory on Heap. Available '
  288.                    +Real_to_Str(MaxAvail,0)+'. Required '
  289.                    +Real_to_Str(value,0);
  290.     3 : Message := 'Error 3 : Field operation not allowed before before Create_Fields';
  291.     4 : Message := 'Error 4 : Field ID: '
  292.                    +Real_to_Str(value,0)+' out of range';
  293.     5 : Message := 'Error 5 : cannot change fields, invalid target field ID: '
  294.                    +Real_to_Str(value,0);
  295.     6 : message := 'Error 6 : Invalid X or Y value defined in Add_Field ID: '
  296.                    +Real_to_Str(value,0);
  297.     7 : Message := 'Error 7 : Cannot Add_message before calling Add_Field';
  298.     8 : Message := 'Error 8 : Cannot Add_Message, invalid Field ID: '+Real_to_Str(value,0);
  299.     9 : message := 'Error 9 : Invalid X or Y coordinate defined in Add_Message ID: '
  300.                    +Real_to_Str(value,0);
  301.     10 : Message := 'Error 10 : Cannot Dispose_fields, no fields exist';
  302.     11 : Message := 'Error 11 : Cannot Create_Fields - fields already created,'
  303.                     +' reset with Dispose_fields';
  304.     12 : Message := 'Error 12 : Use Create_Tables before Activate_Table';
  305.     13 : Message := 'Error 13 : Cannot Activate_Table - Table outside range';
  306.     14 : Message := 'Error 14 : call Create_Tables or Create_Fields first';
  307.     else Message := 'Aborting';
  308.     end; {case}
  309.     WriteAT(1,12,black,lightgray,Message);
  310.     Repeat Until keypressed;
  311.     Halt(10);     {IO fatal error returns an error level of 10}  {5.01}
  312. end;    {proc IOTTT_Error}
  313.  
  314. Procedure Ding;
  315. begin
  316.     If Table[CurrentTable]^.ITTT.Beep then
  317.     begin
  318.        sound(750);delay(150);nosound;
  319.     end;
  320. end;    {proc Ding}
  321.  
  322. Procedure Reset_Table(var T: TableSettings);
  323. begin
  324.     with T do
  325.     begin
  326.         HiFCol := white;
  327.         HiBCol := blue;
  328.         LoFCol := blue;
  329.         LoBCol := lightgray;
  330.         MsgFCol:= yellow;
  331.         MsgBCol:= red;
  332.         TotalFields:=MaxInputFields;
  333.         CurrentField := 1;
  334.         AllowEsc := true;                  {5.00e}
  335.         IO_FieldsSet := false;
  336.         Displayed    := false;
  337.         Beep    := true;
  338.         WhiteSpace   := #250;
  339.         ErrorLine := 24;
  340.         Insert := true;
  341.         {$IFDEF VER50}
  342.         LeaveFieldHook := NoFieldHook;
  343.         EnterFieldHook := NoFieldHook;
  344.         CharHook := NoCharHook;
  345.         InsertProc := DefaultInsertHook;
  346.         {$ELSE}
  347.         IO_LeaveHook  := nil;
  348.         IO_EnterHook  := nil;
  349.         IO_CharHook   := nil;
  350.         IO_InsertHook := @DefaultInsertHook;
  351.         {$ENDIF}
  352.         FinishChar := IOFinish;
  353.     end;
  354. end;
  355.  
  356. Procedure Create_Tables(No_Of_Tables:byte);
  357. var
  358.   I:integer;
  359.   Room_needed : integer;
  360. begin
  361.     If No_of_Tables in [1..MaxTables] then
  362.     begin
  363.         Room_needed := sizeof(Table[1]^);
  364.         For I := 1 to No_of_Tables do
  365.         begin
  366.             If MaxAvail >= Room_needed then
  367.             begin
  368.                 GetMem(Table[I],Room_Needed);
  369.                 Reset_Table(Table[I]^.ITTT)
  370.             end
  371.             else  {not enough heap space}
  372.                     IOTTT_Error(2,Room_needed); {end MemAvail If clause}
  373.         end;
  374.         TotalTables := No_Of_Tables;
  375.     end;
  376.     TableSet := true;
  377. end;   {IO_SetTables}
  378.  
  379.  Procedure Activate_Table(Table_No:byte);
  380.  {}
  381.  begin
  382.      If not TableSet then
  383.         IOTTT_Error(12,0.0);
  384.      If Table_No > TotalTables then
  385.         IOTTT_Error(13,0.0);
  386.      CurrentTable := Table_No
  387.  end; {of proc Activate_Table}
  388. {$IFDEF VER50}
  389.  
  390.  Procedure Assign_LeaveFieldHook(Proc:Move_Field_Proc);
  391.  {}
  392.  begin
  393.      If not TableSet then
  394.         IOTTT_Error(14,0.0);
  395.      Table[CurrentTable]^.ITTT.LeaveFieldHook := proc;
  396.  end; {of proc Assign_Field_Proc}
  397.  
  398.  Procedure Assign_EnterFieldHook(Proc:Move_Field_Proc);
  399.  {}
  400.  begin
  401.      Table[CurrentTable]^.ITTT.EnterFieldHook := proc;
  402.  end; {of proc Assign_Field_Proc}
  403.  
  404.  Procedure Assign_CharHook(Proc:Char_Hook_Proc);
  405.  {}
  406.  begin
  407.      If not TableSet then
  408.         IOTTT_Error(14,0.0);
  409.      Table[CurrentTable]^.ITTT.CharHook := proc;
  410.  end; {of proc Assign_Char_Proc}
  411.  
  412.  Procedure Assign_InsHook(Proc:Insert_Proc);
  413.  {}
  414.  begin
  415.      If not TableSet then
  416.         IOTTT_Error(14,0.0);
  417.      Table[CurrentTable]^.ITTT.InsertProc := proc;
  418.  end; {of proc Assign_Char_Proc}
  419. {$ENDIF}
  420.  
  421.  Procedure Assign_Finish_Char(Ch : char);
  422.  {}
  423.  begin
  424.      If not TableSet then
  425.         IOTTT_Error(14,0.0);
  426.      Table[CurrentTable]^.ITTT.FinishChar := Ch;
  427.  end; {of proc Assign_Finish_Char}
  428.  
  429. {$IFDEF IOFULL}
  430.  Procedure Set_Default_Rules(Rules:word);
  431.  {}
  432.  begin
  433.      If not TableSet then
  434.         IOTTT_Error(14,0.0);
  435.      Default_Allow_Null    := (Rules and AllowNull) = AllowNull;
  436.      Default_Suppress_Zero := (Rules and SuppressZero) = SuppressZero;
  437.      Default_Right_Justify := (Rules and RightJustify) = RightJustify;
  438.      Default_Erase_Default := (Rules and EraseDefault) = EraseDefault;
  439.      Default_Jump_Full     := (Rules and JumpIfFull) = JumpIfFull;
  440.  end; {of proc Set_Default_Rules}
  441. {$ENDIF}
  442.  
  443. Procedure Create_Fields(No_of_fields:byte);
  444. var
  445.   I:integer;
  446.   Room_needed : integer;
  447. begin
  448.     If not TableSet then
  449.        Create_Tables(1);
  450.     with Table[CurrentTable]^ do
  451.     begin
  452.     (*
  453.         If ITTT.IO_FieldsSet then IOTTT_Error(11,0);       {already set}
  454.     *)
  455.         If No_of_Fields in [1..MaxInputFields] then
  456.         begin
  457.             Room_needed := sizeof(FieldDefn[0]^);
  458.             For I := 0 to No_of_fields do
  459.             begin
  460.                 If MaxAvail >= Room_needed then
  461.                 begin
  462.                     GetMem(FieldDefn[I],Room_Needed);
  463.                     with FieldDefn[I]^ do
  464.                     begin
  465.                         Message     := '';
  466.                         MsgX        := 81;     {zero means auto-center}
  467.                         MsgY        := 0;
  468.                         FieldType   := IOUndefined;
  469.                         SPtr        := nil;
  470.                         FieldLen    := 0;
  471.                         FieldStr    := '';
  472.                         FieldFmt    := '';
  473.                         Right_Justify := false;
  474.                         {$IFDEF IOFULL}
  475.                         Rules_Set := False;     {5.00h}
  476.                         {$ENDIF}
  477.                     end;   {With}
  478.                 end
  479.                 else  {not enough heap space}
  480.                     IOTTT_Error(2,Room_needed); {end MemAvail If clause}
  481.             end;
  482.             ITTT.TotalFields := No_of_Fields;
  483.             ITTT.IO_FieldsSet := true;
  484.         end
  485.         else  {Invalid No_of_fields}
  486.            IOTTT_Error(1,No_of_fields);
  487.    end; {with table}
  488. end;  {Proc Create_Fields}
  489.  
  490.  Procedure Define_Colors(HiF,HiB,LoF,LoB,MsgF,MsgB:byte);
  491.  {}
  492.  begin
  493.      If not TableSet then
  494.         IOTTT_Error(14,0.0);
  495.      With Table[CurrentTable]^.ITTT do
  496.      begin
  497.          HiFCol := HiF;
  498.          HiBCol := HiB;
  499.          LoFCol := LoF;
  500.          LoBCol := LoB;
  501.          MsgFCol := MsgF;
  502.          MsgBCol := MsgB;
  503.      end;
  504.  end;    {Proc Define_Colors}
  505.  
  506.  Procedure Check_Field_Number(DefId : byte);
  507.  {internal}
  508.  begin
  509.      If not TableSet then
  510.         IOTTT_Error(14,0.0);
  511.      with Table[CurrentTable]^ do
  512.      begin
  513.          If not ITTT.IO_FieldsSet then IOTTT_Error(3,0);
  514.          If (DefID < 1) or (DefID>ITTT.TotalFields) then
  515.             IOTTT_Error(4,Defid);
  516.      end;
  517.  end; {of proc Check_Field_Number}
  518.  
  519. Procedure Add_Field(DefID,DefU,DefD,DefL,DefR,DefX,DefY:byte);
  520. begin
  521.     with Table[CurrentTable]^ do
  522.     begin
  523.         Check_Field_Number(DefID);
  524.         If  (DefX < 1) or (DefX > 80)
  525.         or  (DefY < 1) or (DefY > DisplayLines) then
  526.            IOTTT_Error(6,Defid);
  527.         With FieldDefn[DefID]^ do
  528.         begin
  529.             If DefU <= ITTT.TotalFields then
  530.                Upfield    := DefU;
  531.             If DefD <= ITTT.TotalFields then
  532.                Downfield  := DefD;
  533.             If DefL <= ITTT.TotalFields then
  534.                Leftfield  := DefL;
  535.             If DefR <= ITTT.TotalFields then
  536.                Rightfield := DefR;
  537.             X          := DefX;
  538.             Y          := DefY;
  539.         end;
  540.    end; {with Table}
  541. end; {proc ADD_Field}
  542.  
  543. Procedure Add_Message(DefID,DefX,DefY : byte; DefString : string);
  544. begin
  545.     Check_Field_Number(DefId);   {5.01}
  546.     with Table[CurrentTable]^ do
  547.     begin
  548.         If not ITTT.IO_FieldsSet then IOTTT_Error(7,0);
  549.         If (DefID < 1) or (DefID > ITTT.TotalFields) then IOTTT_Error(8,DefID);
  550.         If (DefX < 0) or (DefX > 80) or (DefY < 1) or (DefY > 25) then IOTTT_Error(9,DefID);
  551.         With FieldDefn[Defid]^ do
  552.         begin
  553.             MsgX := DefX;
  554.             MsgY := DefY;
  555.             Message := DefString;
  556.         end;
  557.     end; {with Table}
  558. end;  {proc ADD_Message}
  559.  
  560.  Function Max_string_length(DefFormat:string) : byte;
  561.  var I,Counter : byte;
  562.  begin
  563.      Counter := 0;
  564.      For I := 1 to length(DefFormat) do
  565.          if (DefFormat[I] in FmtChars) then
  566.             Counter := succ(counter);
  567.      Max_string_length := Counter;
  568.  end;  {sub func Max_String_Length}
  569.  
  570.  Function  Last_Char_Left_Justified(Str,Fmt:string): byte;
  571.  var
  572.     LenS,LenF,S,
  573.     Counter : byte;
  574.  begin
  575.      Counter := 0;
  576.      S := 0;
  577.      LenF := Length(Fmt);
  578.      LenS := Length(Str);
  579.      Repeat
  580.           Inc(Counter);
  581.           If Fmt[Counter] in FmtChars then
  582.              Inc(S);
  583.      Until (S > LenS) or (Counter > LenF);
  584.      Last_Char_Left_Justified := counter;
  585.  end;
  586.  
  587.  Function  Pos_of_Last_Input_Char(DefFormat:string): byte;
  588.  var
  589.     Counter : byte;
  590.  begin
  591.      Counter := Succ(Length(DefFormat));
  592.      Repeat
  593.           Dec(Counter);
  594.      Until (DefFormat[Counter] in FmtChars) or (Counter = 0);
  595.      Pos_of_Last_Input_Char := counter;
  596.  end;
  597.  
  598. Procedure Set_Cursor(DefID:byte);
  599. begin
  600.     with Table[CurrentTable]^.FieldDefn[DefID]^ do
  601.     begin
  602. {$IFDEF IOFULL}
  603.         If Right_Justify then
  604.         begin
  605.             CursorX := pred(X) + Pos_of_Last_Input_Char(FieldFmt);
  606.             StrLocX := length(FieldStr);
  607.         end
  608.         else       {left Justified}
  609.         begin
  610. {$ENDIF}
  611.            If FieldStr = '' then
  612.               StrLocX := 1
  613.            else
  614.            begin
  615.                StrLocX := succ(Length(FieldStr));
  616.                If StrLocX > FieldLen then
  617.                   StrLocX := FieldLen;
  618.            end;
  619.            CursorX := Last_Char_Left_Justified(FieldStr,FieldFmt);
  620.            If CursorX > length(FieldFmt) then       {5.00 I}
  621.               dec(CursorX);
  622.            CursorX := CursorX + pred(X);
  623. {$IFDEF IOFULL}
  624.         end;
  625. {$ENDIF}
  626.     end;
  627. end;
  628.  
  629.  
  630. Function Var_To_String(DefID : byte):String;
  631. var Str : string;
  632. begin
  633.     with Table[CurrentTable]^.FieldDefn[DefID]^ do
  634.     begin
  635. {$IFDEF IOFULL}
  636.         Case FieldType of
  637.         IOString  : Str := SPtr^;
  638.         IOByte    : If Suppress_Zero and (BPtr^ = 0) then
  639.                        Str := ''
  640.                     else
  641.                        Str := Int_To_Str(BPtr^);
  642.         IOWord    : If Suppress_Zero and (WPtr^ = 0) then
  643.                        Str := ''
  644.                     else
  645.                        Str := Int_To_Str(WPtr^);
  646.         IOInteger : If Suppress_Zero and (IPtr^ = 0) then
  647.                        Str := ''
  648.                     else
  649.                        Str := Int_To_Str(IPtr^);
  650.         IOLongInt : If Suppress_Zero and (LPtr^ = 0) then
  651.                        Str := ''
  652.                     else
  653.                        Str := Int_To_Str(LPtr^);
  654.         IODate    : If Suppress_Zero and (DPtr^ = 0) then
  655.                        Str := ''
  656.                     else
  657.                        Str := Unformatted_date(Julian_to_date(WPtr^,DFormat));
  658.         IOReal    : If Suppress_Zero and (RPtr^ = 0.0) then
  659.                        Str := ''
  660.                     else
  661.                     begin
  662.                         Str := Real_To_Str(RPtr^,RealDP);
  663.                         If RealDP <> Floating then
  664.                             Delete(Str,LastPos('.',Str),1);
  665.                     end;
  666.         end; {case}
  667. {$ELSE}
  668.       Str := SPtr^;
  669. {$ENDIF}
  670.     end;   {with}
  671.     Var_To_String := Str;
  672.     Set_Cursor(DefID);
  673.  end; {func Var_To_String}
  674.  
  675.  Function Formatted_String(Str,Fmt:string;RJ:boolean):string;
  676.  var
  677.  TempStr : string;
  678.  I,J : byte;
  679.  K : integer;
  680.  begin
  681. {$IFDEF IOFULL}
  682.      If RJ then
  683.      begin
  684.          J := succ(Length(Fmt));
  685.          K := length(Str);
  686.          For I := length(Fmt) downto 1 do
  687.          begin
  688.              If not (Fmt[I] in FmtChars) then
  689.              begin
  690.                  TempStr[I] := Fmt[I] ;  {force any none format charcters into string}
  691.                  dec(J);
  692.              end
  693.              else    {format character}
  694.              begin
  695.                  If K > 0  then
  696.                     TempStr[I] := Str[K]
  697.                  else
  698.                     TempStr[I] := Table[CurrentTable]^.ITTT.WhiteSpace;
  699.                  Dec(K);
  700.              end;
  701.          end;
  702.      end
  703.      else   {left Justified}
  704.      begin
  705. {$ENDIF}
  706.          J := 0;
  707.          For I := 1 to length(Fmt) do
  708.          begin
  709.              If not (Fmt[I] in FmtChars) then
  710.              begin
  711.                  TempStr[I] := Fmt[I] ;  {force any none format charcters into string}
  712.                  inc(J);
  713.              end
  714.              else    {format character}
  715.              begin
  716.                  If I - J <= length(Str) then
  717.                     TempStr[I] := Str[I - J]
  718.                  else
  719.                     TempStr[I] := Table[CurrentTable]^.ITTT.WhiteSpace;
  720.              end;
  721.          end;
  722. {$IFDEF IOFULL}
  723.      end;
  724. {$ENDIF}
  725.      TempStr[0] := char(length(Fmt));  {set initial byte to string length}
  726.      Formatted_String := Tempstr;
  727.  end;  {Func Formatted_String}
  728.  
  729. {$IFDEF IOFULL}
  730.  Procedure Invalid_Message(var CH : char);
  731.  begin
  732.    Ding;
  733.    With Table[CurrentTable]^.ITTT do
  734.    TempMessageCH(1,ErrorLine,MsgFCol,MsgBCol,
  735.                PadCenter('Invalid number - press any key ... and make correction!',80,' '),CH);
  736.  end;
  737.  
  738.  Procedure Invalid_Date_Message(var CH : char;Format:byte);
  739.  var FmtStr : string;
  740.  begin
  741.    Ding;
  742.    Case Format of
  743.    MMDDYY   : FmtStr := 'MM/DD/YY';
  744.    MMDDYYYY : FmtStr := 'MM/DD/YYYY';
  745.    MMYY     : FmtStr := 'MM/YY';
  746.    MMYYYY   : FmtStr := 'MM/YYYY';
  747.    DDMMYY   : FmtStr := 'DD/MM/YY';
  748.    DDMMYYYY : FmtStr := 'DD/MM/YYYY';
  749.    end; {case}
  750.    With Table[CurrentTable]^.ITTT do
  751.    TempMessageCH(1,ErrorLine,MsgFCol,MsgBCol,
  752.                PadCenter('Error format is '+FmtStr+'  - press any key ... and make correction!',80,' '),CH);
  753.  end;
  754.  
  755.  Procedure OutOfRange_Message(MinS,MaxS : StrScreen;var CH:char);
  756.  var
  757.    S : StrScreen;
  758.  begin
  759.      Ding;
  760.      S := 'Error value must be in the range '+MinS+' to '+MaxS+' - press any key & correct';
  761.      With Table[CurrentTable]^.ITTT do
  762.           TempMessageCh(1,ErrorLine,MsgFCol,MsgBCol,PadCenter(S,80,' '),CH);
  763.  end;
  764.  
  765.  Procedure Validate_Field(DefID:byte; var result:byte);
  766.  {}
  767.  var
  768.    VL : longint;
  769.    VR : Real;
  770.    ChV : char;
  771.    RetCode : integer;
  772.  
  773.                      Procedure Check_Number(Min,Max: longint;
  774.                                             Len : byte;
  775.                                             StrMax : string);
  776.                      {}
  777.                      begin
  778.                          with Table[CurrentTable]^.FieldDefn[DefID]^ do
  779.                          begin
  780.                              val(FieldStr,VL,Retcode);
  781.                              If Retcode <> 0 then
  782.                              begin
  783.                                  Invalid_Message(ChV);
  784.                                  If ChV = #027 then
  785.                                  begin
  786.                                     Result := EscValid;
  787.                                     FieldStr := Var_To_String(DefID);
  788.                                  end
  789.                                  else
  790.                                     Result := NotValid;
  791.                              end
  792.                              else
  793.                              begin
  794.                                  If (VL < Min)
  795.                                  or (VL > Max)
  796.                                  or ((length(FieldStr) > Len) and (FieldStr > StrMax)) then
  797.                                  begin
  798.                                     OutOfRange_Message(Int_To_Str(Min),Int_To_Str(Max),ChV);
  799.                                     If ChV = #027 then
  800.                                     begin
  801.                                        FieldStr := Var_To_String(DefID);
  802.                                        Result := EscValid;
  803.                                     end
  804.                                     else
  805.                                        Result := NotValid;
  806.                                  end
  807.                                  else
  808.                                  begin
  809.                                      Result := valid;
  810.                                  end;
  811.                              end;
  812.                          end; {with}
  813.                      end; {of proc Check_Number}
  814.  
  815.                      Procedure Check_date;
  816.                      {}
  817.                      begin
  818.                          with Table[CurrentTable]^.FieldDefn[DefID]^ do
  819.                          begin
  820.                              If not Valid_Date(FieldStr,DFormat) then
  821.                              begin
  822.                                  Invalid_Date_Message(ChV,DFormat);
  823.                                  If ChV = #027 then
  824.                                  begin
  825.                                     Result := EscValid;
  826.                                     FieldStr := Var_To_String(DefID);
  827.                                  end
  828.                                  else
  829.                                     Result := NotValid;
  830.                              end
  831.                              else
  832.                              begin
  833.                                  VL := Date_to_Julian(FieldStr,DFormat);
  834.                                  If (VL < DMin)
  835.                                  or (VL > DMax) then
  836.                                  begin
  837.                                     OutOfRange_Message(Julian_to_date(DMin,DFormat),Julian_to_date(DMax,DFormat),ChV);
  838.                                     If ChV = #027 then
  839.                                     begin
  840.                                        FieldStr := Var_To_String(DefID);
  841.                                        Result := EscValid;
  842.                                     end
  843.                                     else
  844.                                        Result := NotValid;
  845.                                  end
  846.                                  else
  847.                                  begin
  848.                                      Result := valid;
  849.                                  end;
  850.                              end;
  851.                          end; {with}
  852.                      end; {of proc Check_date}
  853.  
  854.  begin
  855.      Result := Valid; {assume alls well}
  856.      with Table[CurrentTable]^ do
  857.           with FieldDefn[DefID]^ do
  858.      begin
  859.          If (FieldStr = '') and Allow_Null then
  860.             exit;
  861.          Case FieldType of
  862.          IOByte    : Check_Number(BMin,BMax,2,'255');
  863.          IOWord    : Check_Number(WMin,WMax,4,'65535');
  864.          IOInteger : Check_Number(IMin,IMax,5,'32767');
  865.          IOLongInt : Check_Number(LMin,LMax,11,'2147483647');
  866.          IODate    : Check_Date;
  867.          IOReal    : begin
  868.                          val(  Strip('B',ITTT.WhiteSpace,
  869.                                      Formatted_String(FieldStr,FieldFmt,Right_Justify)),
  870.                                VR,
  871.                                Retcode
  872.                             );
  873.                          If Retcode <> 0 then
  874.                          begin
  875.                              Invalid_Message(ChV);
  876.                              If ChV = #027 then
  877.                              begin
  878.                                 Result := EscValid;
  879.                                 FieldStr := Var_To_String(DefID);
  880.                              end
  881.                              else
  882.                                 Result := NotValid;
  883.                          end
  884.                          else
  885.                          begin
  886.                              If (VR < RMin)
  887.                              or (VR > RMax) then
  888.                              begin
  889.                                 OutOfRange_Message(Real_To_Str(RMin,RealDP),Real_To_Str(RMax,RealDP),ChV);
  890.                                 If ChV = #027 then
  891.                                 begin
  892.                                    FieldStr := Var_To_String(DefID);
  893.                                    Result := EscValid;
  894.                                 end
  895.                                 else
  896.                                    Result := NotValid;
  897.                              end
  898.                              else
  899.                              begin
  900.                                  Result := valid;
  901.                              end;
  902.                          end;
  903.                      end;
  904.          end; {case}
  905.      end;   {with}
  906.  end; {of proc Validate_Field}
  907. {$ENDIF}
  908.  
  909.  Procedure String_To_Var(DefID : byte);
  910.  begin
  911.     with Table[CurrentTable]^ do
  912.          with FieldDefn[DefID]^ do
  913. {$IFDEF IOFULL}
  914.          begin
  915.              Case FieldType of
  916.              IOString  : SPtr^ := FieldStr;
  917.              IOByte    : BPtr^ := Str_to_Int(FieldStr);
  918.              IOWord    : WPtr^ := Str_to_Int(FieldStr);
  919.              IOInteger : IPtr^ := Str_to_Int(FieldStr);
  920.              IOLongInt : LPtr^ := Str_to_Long(FieldStr);
  921.              IOReal    : RPtr^ := Str_to_Real(Strip('B',ITTT.WhiteSpace,
  922.                                               Formatted_String(FieldStr,FieldFmt,Right_Justify)));
  923.              IODate    : If FieldStr = '' then
  924.                             DPtr^ := 0
  925.                          else
  926.                             DPtr^ := Date_to_Julian(FieldStr,Dformat);
  927.              end; {case}
  928.         end;   {with}
  929. {$ELSE}
  930.        SPTR^ := FieldStr;
  931. {$ENDIF}
  932.  end; {proc String_to_var}
  933.  
  934. {$IFDEF IOFULL}
  935.  Procedure Set_Misc_Field_Defaults(DefID:byte);
  936.  {}
  937.  begin
  938.      Check_Field_Number(DefId);   {5.01}
  939.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  940.      begin
  941.          Allow_Null    := Default_Allow_Null;
  942.          Suppress_Zero := Default_Suppress_Zero;
  943.          Right_Justify := Default_Right_Justify;
  944.          Erase_Default := Default_Erase_Default;
  945.          Allow_Char    := Default_Allow_Char;
  946.          DisAllow_Char := Default_DisAllow_Char;
  947.          Jump_Full     := Default_Jump_Full;    {fix 5.00a}
  948.          Set_Cursor(DefID);
  949.          Rules_Set := true;   {5.00h}
  950.      end;  {with}
  951.  end; {of proc Set_Misc_Field_Defaults}
  952.  
  953.  Procedure Field_Rules(DefID:byte;
  954.                        Rules:word;
  955.                        AChar: IOCharSet;
  956.                        DChar: IOCharSet);
  957.  {}
  958.  begin
  959.      Check_Field_Number(DefId);   {5.01}
  960.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  961.      begin
  962.          Allow_Null     := (Rules and AllowNull) = AllowNull;
  963.          Suppress_Zero  := (Rules and SuppressZero) = SuppressZero;
  964.          If (FieldType = IOReal)
  965.          and (RealDP > 0)
  966.          and (RealDp <> Floating) then
  967.              Right_Justify := true       {force Right_Justify}
  968.          else
  969.              Right_Justify := (Rules and RightJustify) = RightJustify;
  970.          Erase_Default := (Rules and EraseDefault) = EraseDefault;
  971.          Jump_Full := (Rules and JumpIfFull) = JumpIfFull;
  972.          Allow_Char    := Achar;
  973.          If (RealDP <> Floating) and (DChar = [#0])  then
  974.             DisAllow_Char := ['.']
  975.          else
  976.             DisAllow_Char := Dchar;
  977.          FieldStr      := Var_To_String(DefID);
  978.          Rules_Set := true;   {5.00h}
  979.      end;  {with}
  980.  end; {of proc Field_Rules}
  981. {$ENDIF}
  982.  
  983.  Procedure String_Field(DefID:byte;
  984.                         var Strvar:String;
  985.                         DefFormat:string);
  986.  {}
  987.  begin
  988.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  989.      begin
  990.          Check_Field_Number(DefID);
  991. {$IFDEF IOFULL}
  992.          FieldType     := IOString;
  993. {$ENDIF}
  994.          SPtr          := @StrVar;
  995.          FieldStr      := Sptr^;
  996.          FieldFmt      := DefFormat;
  997.          FieldLen      := Max_String_Length(FieldFmt);
  998. {$IFDEF IOFULL}
  999.          If Rules_Set then                 {5.00h}
  1000.             Set_Cursor(DefID)
  1001.          else
  1002.             Set_Misc_Field_Defaults(DefID);
  1003. {$ELSE}
  1004.          Set_Cursor(DefID);
  1005. {$ENDIF}
  1006.      end;
  1007.  end; {of proc String_Field}
  1008.  
  1009. {$IFDEF IOFULL}
  1010.  Procedure Byte_Field(DefID:byte;
  1011.                       var Bytevar:Byte;
  1012.                       DefFormat:string;
  1013.                       Min,Max : byte);
  1014.  {}
  1015.  begin
  1016.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  1017.      begin
  1018.          Check_Field_Number(DefID);
  1019.          FieldType     := IOByte;
  1020.          If Rules_Set then                 {5.00h}
  1021.             Set_Cursor(DefID)
  1022.          else
  1023.             Set_Misc_Field_Defaults(DefID);
  1024.          SPtr          := @Bytevar;
  1025.          FieldStr := Var_To_String(DefID);
  1026.          If DefFormat = '' then
  1027.             FieldFmt := '###'
  1028.          else
  1029.             FieldFmt := DefFormat;
  1030.          If (Max = 0) or (Max < Min) then
  1031.             BMax := 255
  1032.          else
  1033.             BMax := Max;
  1034.          If Min > BMax then
  1035.             BMin := 0
  1036.          else
  1037.             BMin := Min;
  1038.          FieldLen      := Max_String_Length(FieldFmt);
  1039.          Set_Cursor(DefID);             {5.00h}
  1040.      end;
  1041.  end; {of proc Byte_Field}
  1042.  
  1043.  Procedure Word_Field(DefID:byte;
  1044.                       var Wordvar:Word;
  1045.                       DefFormat:string;
  1046.                       Min,Max : word);
  1047.  {}
  1048.  begin
  1049.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  1050.      begin
  1051.          Check_Field_Number(DefID);
  1052.          FieldType     := IOWord;
  1053.          If Rules_Set then                 {5.00h}
  1054.             Set_Cursor(DefID)
  1055.          else
  1056.             Set_Misc_Field_Defaults(DefID);
  1057.          SPtr          := @WordVar;
  1058.          FieldStr      := Var_to_String(DefID);
  1059.          If DefFormat = '' then
  1060.             FieldFmt := '#####'
  1061.          else
  1062.             FieldFmt := DefFormat;
  1063.          If (Max = 0) or (Max < Min) then
  1064.              WMax := 65535
  1065.          else
  1066.             WMax := Max;
  1067.          If Min > WMax then
  1068.             WMin := 0
  1069.          else
  1070.             WMin := MIn;
  1071.          FieldLen      := Max_String_Length(FieldFmt);
  1072.          Set_Cursor(DefID);          {5.00h}
  1073.      end;
  1074.  end; {of proc Word_Field}
  1075.  
  1076.  Procedure Integer_Field(DefID:byte;
  1077.                       var Integervar:Integer;
  1078.                       DefFormat:string;
  1079.                       Min,Max:Integer);
  1080.  {}
  1081.  begin
  1082.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  1083.      begin
  1084.          Check_Field_Number(DefID);
  1085.          FieldType     := IOInteger;
  1086.          If Rules_Set then                 {5.00h}
  1087.             Set_Cursor(DefID)
  1088.          else
  1089.             Set_Misc_Field_Defaults(DefID);
  1090.          Set_Misc_Field_Defaults(DefID);
  1091.          SPtr          := @IntegerVar;
  1092.          FieldStr      := Var_to_String(DefID);
  1093.          If DefFormat = '' then
  1094.             FieldFmt := '######'
  1095.          else
  1096.             FieldFmt := DefFormat;
  1097.          If (Max = 0) or (Max < Min) then
  1098.             IMax := 32767
  1099.          else
  1100.             IMax := Max;
  1101.          If Min > WMax then
  1102.             IMin := -32768
  1103.          else
  1104.             IMin := Min;
  1105.          FieldLen      := Max_String_Length(FieldFmt);
  1106.          Set_Cursor(DefID);   {5.00h}
  1107.      end;
  1108.  end; {of proc Integer_Field}
  1109.  
  1110.  Procedure LongInt_Field(DefID:byte;
  1111.                       var LongIntvar:LongInt;
  1112.                       DefFormat:string;
  1113.                       Min,Max : LongInt);
  1114.  {}
  1115.  begin
  1116.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  1117.      begin
  1118.          Check_Field_Number(DefID);
  1119.          FieldType     := IOLongInt;
  1120.          If Rules_Set then                 {5.00h}
  1121.             Set_Cursor(DefID)
  1122.          else
  1123.             Set_Misc_Field_Defaults(DefID);
  1124.          SPtr          := @LongIntVar;
  1125.          FieldStr      := Var_to_String(DefID);
  1126.          If DefFormat = '' then
  1127.             FieldFmt := '###########'
  1128.          else
  1129.             FieldFmt := DefFormat;
  1130.          If (max = 0) or (Max < Min) then
  1131.             LMax := 2147483647
  1132.          else
  1133.             LMax := Max;
  1134.          If (Min > LMax) then
  1135.             LMin := -2147483647
  1136.          else
  1137.             LMin := Min;
  1138.          FieldLen      := Max_String_Length(FieldFmt);
  1139.          Set_Cursor(DefID);           {5.00h}
  1140.      end;
  1141.  end; {of proc LongInt_Field}
  1142.  
  1143.  Procedure Date_Field(DefID:byte;
  1144.                       var Datevar:Dates;
  1145.                       DateFormat:byte;
  1146.                       DefFormat:string;
  1147.                       Min,Max : Dates);
  1148.  {}
  1149.  begin
  1150.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  1151.      begin
  1152.          Check_Field_Number(DefID);
  1153.          FieldType     := IODate;
  1154.          If Rules_Set then                 {5.00h}
  1155.             Set_Cursor(DefID)
  1156.          else
  1157.             Set_Misc_Field_Defaults(DefID);
  1158.          SPtr          := @DateVar;
  1159.          If DateVar = 0 then
  1160.             FieldStr := ''
  1161.          else
  1162.             FieldStr      := Unformatted_date(Julian_to_Date(DateVar,DateFormat));
  1163.          If DefFormat = '' then
  1164.          begin
  1165.              Case DateFormat of
  1166.              DDMMYY,MMDDYY :       FieldFmt := '##/##/##';
  1167.              MMYY          :       FIeldFmt := '##/##';
  1168.              MMYYYY        :       FieldFmt := '##/####';
  1169.              DDMMYYYY,
  1170.              MMDDYYYY      :       FieldFmt := '##/##/####';
  1171.              end; {Case}
  1172.          end
  1173.          else
  1174.             FieldFmt := DefFormat;
  1175.          If (Max = 0) or (Max < Min) then
  1176.              DMax := 65535
  1177.          else
  1178.             DMax := Max;
  1179.          If Min > WMax then
  1180.             DMin := 0
  1181.          else
  1182.             DMin := MIn;
  1183.          DFormat := DateFormat;
  1184.          FieldLen      := Max_String_Length(FieldFmt);
  1185.          Set_Cursor(DefID);   {5.00h}
  1186.      end;
  1187.  end; {of proc Date_Field}
  1188.  
  1189.  Procedure Real_Field(DefID:byte;
  1190.                       var Realvar:Real;
  1191.                       DefFormat:string;
  1192.                       Min,Max : real);
  1193.  {}
  1194.  var p : byte;
  1195.  begin
  1196.      with Table[CurrentTable]^.FieldDefn[DefID]^ do
  1197.      begin
  1198.          Check_Field_Number(DefID);
  1199.          FieldType     := IOReal;
  1200.          If Rules_Set then                 {5.00h}
  1201.             Set_Cursor(DefID)
  1202.          else
  1203.             Set_Misc_Field_Defaults(DefID);
  1204.          SPtr          := @RealVar;
  1205.          If DefFormat = '' then
  1206.             FieldFmt := '############'
  1207.          else
  1208.             FieldFmt := DefFormat;
  1209.          P := LastPos('.',FieldFmt);
  1210.          If P = 0 then
  1211.             RealDP  := Floating
  1212.          else
  1213.             RealDP := Length(FieldFmt) - P;
  1214.          If RealDP = 0 then
  1215.             Delete(FieldFmt,P,1);            {remove the end decimal place}
  1216.          If (Max = 0.0) or (Max < Min) then
  1217.             RMax := 1.7E+37                  {for compatibiltity with Turbo4}
  1218.          else
  1219.             RMax := Max;
  1220.          If Min > RMax then
  1221.             RMin := 2.9E-38                  {for compatibiltity with Turbo4}
  1222.          else
  1223.             RMin := Min;
  1224.          If (RealDP <> 0) and (RealDP <> Floating) then
  1225.             Right_Justify := true;
  1226.          If RealDP <> Floating then
  1227.             DisAllow_Char := ['.'];
  1228.          FieldStr      := Var_to_String(DefID);
  1229.          FieldLen      := Max_String_Length(FieldFmt);
  1230.          Set_Cursor(DefID);   {5.00h}
  1231.      end;
  1232.  end; {of proc Real_Field}
  1233. {$ENDIF}
  1234.  
  1235. Procedure Hilight(ID:byte);      {display cell in bright colors}
  1236. begin
  1237.     with Table[CurrentTable]^ do
  1238.          with FieldDefn[ID]^ do
  1239.               WriteAT(X,Y,ITTT.HiFCol,ITTT.HiBCol,
  1240.                       Formatted_String(FieldStr,FieldFmt,Right_Justify));
  1241. end;
  1242.  
  1243. Procedure LoLight(ID:byte);      {display cell in dim colors}
  1244. begin
  1245.     with Table[CurrentTable]^ do
  1246.          with FieldDefn[ID]^ do
  1247.              WriteAT(X,Y,ITTT.LoFCol,ITTT.LoBCol,
  1248.                       Formatted_String(FieldStr,FieldFmt,Right_Justify));
  1249. end;
  1250.  
  1251. Procedure Display_All_Fields;
  1252. var I : integer;
  1253. begin
  1254.     If not TableSet then
  1255.         IOTTT_Error(14,0.0);  {5.01}
  1256.     with Table[CurrentTable]^ do
  1257.     begin
  1258.         For I :=  1 to ITTT.TotalFields do
  1259.         begin
  1260.             FieldDefn[I]^.FieldStr := Var_To_String(I);    {fix 5.00 d}
  1261.             Set_Cursor(I);
  1262.             LoLight(I);
  1263.         end;
  1264.         ITTT.Displayed  := true;
  1265.     end; {with Table}
  1266. end;
  1267.  
  1268. Procedure Allow_Esc(OK:boolean);
  1269. begin
  1270.     If not TableSet then
  1271.         IOTTT_Error(14,0.0);  {5.01}
  1272.     Table[CurrentTable]^.ITTT.AllowEsc := OK;
  1273. end;    {proc Allow_Esc}
  1274.  
  1275. Procedure Allow_Beep(OK:boolean);
  1276. begin
  1277.     Table[CurrentTable]^.ITTT.Beep := OK;
  1278. end;    {proc Allow_Beep}
  1279.  
  1280. Procedure Init_Insert_Mode(ON:boolean);
  1281. begin
  1282.     Table[CurrentTable]^.ITTT.Insert := ON;
  1283. end;    {proc Init_Insert_Mode}
  1284.  
  1285. Procedure Dispose_Fields;
  1286. var I : integer;
  1287. begin
  1288.     If not TableSet then
  1289.         IOTTT_Error(14,0.0);  {5.01}
  1290.     with Table[CurrentTable]^ do
  1291.     begin
  1292.         If not ITTT.IO_FieldsSet then IOTTT_Error(10,0);
  1293.         For I := 0 to ITTT.TotalFields do
  1294.             FreeMem(FieldDefn[I],sizeof(FieldDefn[I]^));
  1295.         Reset_Table(ITTT);
  1296.     end; {with Table}
  1297. end; { proc Dispose_Fields}
  1298.  
  1299. Procedure Dispose_Tables;
  1300. var I : integer;
  1301. begin
  1302.     If not TableSet then
  1303.         IOTTT_Error(14,0.0);  {5.01}
  1304.     For I := 1 to TotalTables do
  1305.         FreeMem(Table[I],sizeOf(Table[I]^));
  1306.     TotalTables := 0;
  1307. end;
  1308.  
  1309. {
  1310. ****************************
  1311. *      Main Procedure      *
  1312. ****************************
  1313. }
  1314.  
  1315. Procedure Process_Input(StartField:byte);
  1316. var
  1317.     OldLine : array[1..160] of byte;
  1318.     Finished : boolean;
  1319.     SRefresh,SField : Byte;
  1320.  
  1321.     Procedure DisplayMessage(ID:byte);
  1322.     begin
  1323.         With Table[CurrentTable]^ do
  1324.              with FieldDefn[ID]^ do
  1325.              begin
  1326.                 If MsgX = 0 then   {Center the message}
  1327.                    MsgX := (80 - length(Message)) div 2;
  1328.                 PartSave(MsgX,MsgY,MsgX+length(Message),MsgY,OldLine);
  1329.                 WriteAT(MsgX,MsgY,ITTT.MsgFCol,ITTT.MsgBCol,Message);
  1330.              end;
  1331.     end;
  1332.  
  1333.     Procedure RemoveMessage(ID:byte);
  1334.     var I,LocC : integer;
  1335.     begin
  1336.         With Table[CurrentTable]^.FieldDefn[ID]^ do
  1337.              PartRestore(MsgX,MsgY,MsgX+length(Message),MsgY,OldLine);
  1338.     end; {sub sub proc RemoveMessage}
  1339.  
  1340.     Procedure Check_Refresh_State(Refresh:byte);
  1341.     {}
  1342.     var I : integer;
  1343.     begin
  1344.         with Table[CurrentTable]^ do
  1345.         Case Refresh of
  1346. {$IFDEF IOFULL}
  1347.         Refresh_None :; {do nothing}
  1348.         Refresh_Current: begin
  1349.                              FieldDefn[ITTT.CurrentField]^.FieldStr := Var_to_String(ITTT.CurrentField);
  1350.                              Set_Cursor(ITTT.CurrentField);  {5.00i}
  1351.                              LoLight(ITTT.CurrentField);
  1352.                          end;
  1353.         Refresh_All: begin
  1354.                          Display_All_Fields;
  1355.                      end;
  1356.         End_Input : begin
  1357.                         Display_All_Fields;
  1358.                         Finished := true;
  1359.                     end;
  1360. {$ELSE}
  1361.         Refresh_None   :; {do nothing}
  1362.         Refresh_Current: begin
  1363.                              FieldDefn[I]^.FieldStr := Var_To_String(I);{5.00k}
  1364.                              Set_Cursor(ITTT.CurrentField);   {5.00i}
  1365.                              LoLight(ITTT.CurrentField);
  1366.                          end;
  1367.         Refresh_All    : Display_All_Fields;
  1368.         End_Input      : begin
  1369.                              Display_All_Fields;
  1370.                              Finished := true;
  1371.                          end;
  1372. {$ENDIF}
  1373.         end; {Case}
  1374.     end; {of proc Check_refresh_State}
  1375.  
  1376.   Procedure Change_Fields(ID:byte);
  1377.   var
  1378.     ValidInput:byte;
  1379.     CField : byte;
  1380.     Refresh : byte;
  1381.   begin
  1382.       with Table[CurrentTable]^ do
  1383.       begin
  1384. {$IFDEF IOFULL}
  1385.           Validate_Field(ITTT.CurrentField,ValidInput);
  1386.           If ValidInput <> Valid then
  1387.              exit;
  1388. {$ENDIF}
  1389.           String_to_Var(ITTT.CurrentField);
  1390.           LoLight(ITTT.CurrentField);
  1391.           If FieldDefn[ITTT.CurrentField]^.MsgX <= 80 then
  1392.              RemoveMessage(ITTT.CurrentField);
  1393.           {Now call the "leave field" hook}
  1394.           CField := ITTT.CurrentField;
  1395.           Refresh := Refresh_None;
  1396.           {$IFDEF VER50}
  1397.           ITTT.LeaveFieldHook(CField,Refresh);
  1398.           {$ELSE}
  1399.           If IO_LeaveHook <> Nil then
  1400.              CallLeaveFieldHook(CField,Refresh);
  1401.           {$ENDIF}
  1402.           If CField <> ITTT.CurrentField then
  1403.              ID := CField; {user wants to go to a specific field}
  1404.           Check_Refresh_State(Refresh);
  1405.           If Finished then exit;
  1406.           If ID = 0 then
  1407.           begin
  1408.               Finished := true;
  1409.           end
  1410.           else
  1411.           begin
  1412.               ITTT.CurrentField := ID;
  1413.               CField := ID;
  1414.               {Enter Field Hook}
  1415.               Repeat
  1416.                    ITTT.CurrentField := CField;
  1417.                    Refresh := Refresh_None;
  1418.                    {$IFDEF VER50}
  1419.                    ITTT.EnterFieldHook(CField,Refresh);
  1420.                    {$ELSE}
  1421.                    If IO_EnterHook <> Nil then
  1422.                       CallEnterFieldHook(CField,Refresh);
  1423.                    {$ENDIF}
  1424.                    Check_Refresh_State(Refresh);
  1425.                    If Finished then exit;
  1426.               until CField = ITTT.CurrentField;
  1427.               If (ITTT.CurrentField < 1)
  1428.               or (ITTT.CurrentField > ITTT.TotalFields) then
  1429.                   exit;                      {5.00b}
  1430.               HiLight(ITTT.CurrentField);
  1431.               If FieldDefn[ITTT.CurrentField]^.MsgX <= 80 then
  1432.                  DisplayMessage(ITTT.CurrentField);
  1433.               With FieldDefn[ITTT.CurrentField]^ do
  1434.                   GotoXY(CursorX,Y);
  1435.               {Ding;}
  1436.           end;  {If ID = 0};
  1437.      end; {with Table}
  1438.   end;  {proc change fields}
  1439.  
  1440.   Procedure Erase_Field(ID:byte);
  1441.   begin
  1442.       with Table[CurrentTable]^.FieldDefn[ID]^ do
  1443.       begin
  1444.           FieldStr := '';
  1445.           Set_Cursor(ID);
  1446.       end;
  1447.   end;
  1448.  
  1449.   Procedure Global_Erase;
  1450.   var
  1451.      I : integer;
  1452.      S : string;
  1453.      Ch : char;
  1454.   begin
  1455.       Ding;
  1456.       S := 'Erase all entries!  Are you sure? (Y/N)';
  1457.       With Table[CurrentTable]^.ITTT do
  1458.           TempMessageCh(1,ErrorLine,MsgFCol,MsgBCol,PadCenter(S,80,' '),CH);
  1459.       If Upcase(Ch) <> 'Y' then exit;
  1460.       with Table[CurrentTable]^ do
  1461.       begin
  1462.           For I :=  1 to ITTT.TotalFields do
  1463.               Erase_Field(I);
  1464.           Display_All_Fields;
  1465.           ITTT.CurrentField := 1;
  1466.       end;
  1467.   end;
  1468.  
  1469.   Procedure Cursor_Right;
  1470.   begin
  1471.       With Table[CurrentTable]^ do
  1472.            with FieldDefn[ITTT.CurrentField]^ do
  1473.            begin
  1474.               If (Right_Justify and (StrLocX < length(FieldStr)) and (StrLocX < FieldLen)) or
  1475.                  ((Right_Justify = false) and (StrLocX <= length(FieldStr)) and (StrLocX < FieldLen))then
  1476.               begin
  1477.                   Inc(StrLocX);
  1478.                   Repeat
  1479.                        Inc(CursorX);
  1480.                   Until FieldFmt[CursorX + 1 - X] in FmtChars;
  1481.               end;
  1482.               GotoXY(CursorX,Y);
  1483.           end; {with}
  1484.   end; {Proc Cursor_Right}
  1485.  
  1486.   Procedure Cursor_Left;
  1487.   begin
  1488.       with Table[CurrentTable]^ do
  1489.            With FieldDefn[ITTT.CurrentField]^ do
  1490.            begin
  1491.                If (StrLocX > 1)
  1492.                or ( Right_Justify and (StrLocX > 0) and (length(FieldStr) <> FieldLen) ) then
  1493.                begin
  1494.                    dec(StrLocX);
  1495.                    Repeat
  1496.                         dec(CursorX);
  1497.                    Until FieldFmt[CursorX + 1 - X] in FmtChars;
  1498.                end;
  1499.            end;  {with}
  1500.   end;  {Proc Cursor_left}
  1501.  
  1502.   Procedure Cursor_Home;
  1503.   var
  1504.     Counter1, Counter2 : byte;
  1505.   begin
  1506.       with Table[CurrentTable]^ do
  1507.            With FieldDefn[ITTT.CurrentField]^ do
  1508.                 Repeat
  1509.                      Counter1 := CursorX;
  1510.                      Cursor_Left;
  1511.                 Until Counter1 = CursorX;
  1512.   end;  {Proc Cursor_Home}
  1513.  
  1514.   Procedure Delete_Char;
  1515.   var
  1516.     I : integer;
  1517.   begin
  1518.       with Table[CurrentTable]^ do
  1519.            with FieldDefn[ITTT.CurrentField]^ do   {non format characters}
  1520.            begin
  1521.                If StrLocX > 0 then
  1522.                begin
  1523.                   Delete(FieldStr,StrLocX,1);
  1524.                   If Right_Justify then
  1525.                      Dec(StrLocX);
  1526.                end;
  1527.            end;  {with}
  1528.   end;  {Delete_Chars}
  1529.  
  1530.   Procedure Backspaced;
  1531.   begin
  1532.       with Table[CurrentTable]^ do
  1533.            with FieldDefn[ITTT.CurrentField]^ do
  1534.            begin
  1535.                If StrLocX > 1 then
  1536.                begin
  1537.                    If Right_Justify then
  1538.                    begin
  1539.                        Delete(FieldStr,pred(StrLocX),1);
  1540.                        Dec(StrLocX);
  1541.                    end
  1542.                    else
  1543.                    begin
  1544.                        Cursor_Left;
  1545.                        Delete(FieldStr,StrLocX,1);
  1546.                    end;
  1547.                end;
  1548.            end;  {with}
  1549.   end;  { Proc Backspaced }
  1550.  
  1551.   Procedure Finish_Input;
  1552.   {}
  1553.   var ValidInput : byte;
  1554.   begin
  1555. {$IFDEF IOFULL}
  1556.       Validate_Field(Table[CurrentTable]^.ITTT.CurrentField,ValidInput);
  1557.       If ValidInput = Valid then
  1558.       begin
  1559. {$ENDIF}
  1560.           String_to_Var(Table[CurrentTable]^.ITTT.CurrentField);
  1561.           Finished := true;
  1562. {$IFDEF IOFULL}
  1563.       end;
  1564. {$ENDIF}
  1565.   end; {of proc Finish_Input}
  1566.  
  1567.   Procedure Insert_Character(K : char);
  1568.   begin
  1569.       with Table[CurrentTable]^ do
  1570.            with FieldDefn[ITTT.CurrentField]^ do
  1571.            begin
  1572.                If (length(FieldStr) < FieldLen) then
  1573.                begin
  1574.                    If Right_Justify then
  1575.                    begin
  1576.                        Inc(StrLocX);
  1577.                        Insert(K,FieldStr,StrLocX);
  1578.                    end
  1579.                    else
  1580.                    begin
  1581.                        Insert(K,FieldStr,StrLocX);
  1582.                        Cursor_Right;
  1583.                    end;
  1584.                end
  1585.                else
  1586.                If (FieldLen = 1) then    {fix 5.00c}
  1587.                    FieldStr := K
  1588.                else
  1589.                    Ding;
  1590.       end;
  1591.   end;
  1592.  
  1593.   Procedure OverType_Character(K : char);
  1594.   begin
  1595.       with Table[CurrentTable]^ do
  1596.            with FieldDefn[ITTT.CurrentField]^ do
  1597.            begin
  1598.                If (StrLocX = 0) and Right_Justify then
  1599.                begin
  1600.                    Insert(K,FieldStr,StrLocX);
  1601.                    Inc(StrLocX);
  1602.                end
  1603.                else
  1604.                begin
  1605.                    Delete(FieldStr,StrLocX,1);
  1606.                    Insert(K,FieldStr,StrLocX);
  1607.                    Cursor_Right;
  1608.                end;
  1609.            end;
  1610.   end;
  1611.  
  1612.   Procedure Activity;
  1613.   var
  1614.     K : char;
  1615.     ReturnStr: string;
  1616.     Prior_CursorX : byte;
  1617.     ValidInput : byte;
  1618.     OldField : byte;
  1619.     CField : byte;
  1620.     Refresh: byte;
  1621.   begin
  1622.       OldField := Table[CurrentTable]^.ITTT.CurrentField;
  1623.       K := Getkey;
  1624.       {now the character hook}
  1625.       With Table[CurrentTable]^ do
  1626.       begin
  1627.           CField := ITTT.CurrentField;
  1628.           ReFresh := Refresh_None;
  1629.           {$IFDEF VER50}
  1630.           ITTT.CharHook(K,CField,Refresh);
  1631.           {$ELSE}
  1632.           If IO_CharHook <> Nil then
  1633.              CallCharHook(K,CField,Refresh);
  1634.           {$ENDIF}
  1635.           Check_Refresh_State(Refresh);
  1636.           If CField <> ITTT.CurrentField then
  1637.              Change_Fields(CField); {user wants to go to a specific field}
  1638.           If K = ITTT.FinishChar then
  1639.              Finish_Input
  1640.           else
  1641. {$IFDEF IOFULL}
  1642.              If  (FieldDefn[ITTT.CurrentField]^.Allow_Char <> [#0])
  1643.              and (not (K in FieldDefn[ITTT.CurrentField]^.Allow_Char))
  1644.              and (not (K in Control_Char)) then
  1645.              begin
  1646.                  If K <> No_Char then          {5.00g}
  1647.                     Ding;
  1648.                  Exit;
  1649.              end;
  1650. {$ELSE}
  1651. ;
  1652. {$ENDIF}
  1653.       end;
  1654.  
  1655.       If (K <> No_Char)
  1656.       and (Finished = false) then
  1657.       Case K of
  1658.       #132,   {mouse right but}
  1659.       IOEsc : If Table[CurrentTable]^.ITTT.AllowEsc then
  1660.                  begin
  1661.                      Finished := true;
  1662.                   end
  1663.                   else Ding;
  1664.       #32..#126 : with Table[CurrentTable]^ do
  1665.                       with FieldDefn[ITTT.CurrentField]^ do
  1666.                       begin
  1667.                           If FieldFmt[CursorX - X + 1] = '!' then K := upcase(K);
  1668. {$IFDEF IOFULL}
  1669.                           If (
  1670.                                (Allow_Char = [#0])
  1671.                                or ((Allow_Char <> [#0]) and (K in Allow_Char))
  1672.                              )
  1673.                           and
  1674.                              (
  1675.                                (DisAllow_Char = [#0])
  1676.                                or ((DisAllow_Char <> [#0]) and ((K in DisAllow_Char)= false))
  1677.                              )
  1678.                           then
  1679.                           begin
  1680. {$ENDIF}
  1681.                               If ((K in ['0'..'9','.','-','e','E']) and (FieldFmt[CursorX - X + 1] = '#'))
  1682.                               or ((K in ['a'..'z','A'..'Z',' ',',','.',';',':']) and
  1683.                                                         (FieldFmt[CursorX - X + 1] = '@'))
  1684.                               or (FieldFmt[CursorX - X + 1] = '*')
  1685.                               or (FieldFmt[CursorX - X + 1] = '!') then
  1686.                               begin
  1687. {$IFDEF IOFULL}
  1688.                                   If FirstCharPress then
  1689.                                   begin
  1690.                                       If Erase_Default then
  1691.                                          Erase_Field(ITTT.CurrentField);
  1692.                                       FirstCharPress := false;
  1693.                                   end;
  1694. {$ENDIF}
  1695.                                   If (ITTT.Insert) then
  1696.                                      Insert_Character(K)
  1697.                                   else
  1698.                                      OverType_Character(K);
  1699.                               end
  1700.                               else Ding; {end if K in statement}
  1701. {$IFDEF IOFULL}
  1702.                           end; {if}
  1703. {$ENDIF}
  1704.                       end;  {with}
  1705.       #133,      {mouse left but}
  1706.       #131,      {mouse right}
  1707.       IORightFld,
  1708.       IOTab,
  1709.       IOEnter :  with Table[CurrentTable]^ do
  1710.                      Change_Fields(FieldDefn[ITTT.CurrentField]^.RightField);
  1711.       #130,      {mouse left}
  1712.       IOLeftFld,
  1713.       IOShiftTab : with Table[CurrentTable]^ do
  1714.                        Change_Fields(FieldDefn[ITTT.CurrentField]^.LeftField);
  1715.       IOBackSp : Backspaced;
  1716.       IODel    : Delete_Char;
  1717.       IOLeft   : Cursor_Left;
  1718.       IORight  : Cursor_Right;
  1719.       #128,    {mouse up}
  1720.       IOUp     : with Table[CurrentTable]^ do
  1721.                       Change_Fields(FieldDefn[ITTT.CurrentField]^.UpField);
  1722.       #129,    {mouse down}
  1723.       IODown   : with Table[CurrentTable]^ do
  1724.                       Change_Fields(FieldDefn[ITTT.CurrentField]^.DownField);
  1725.       IOErase    :with Table[CurrentTable]^ do
  1726.                        Erase_Field(ITTT.CurrentField);
  1727.       IOTotErase : Global_Erase;
  1728.       IOIns      : with Table[CurrentTable]^ do
  1729.                    begin
  1730.                        ITTT.Insert := not ITTT.Insert;
  1731.                        {$IFDEF VER50}
  1732.                        ITTT.InsertProc(ITTT.Insert);
  1733.                        {$ELSE}
  1734.                         If IO_InsertHook <> Nil then
  1735.                            CallInsertHook(ITTT.Insert);
  1736.                        {$ENDIF}
  1737.                    end;
  1738.       #199       : Cursor_Home;
  1739.       #207       : with Table[CurrentTable]^ do
  1740.                       Set_Cursor(ITTT.CurrentField);
  1741.       else Ding;
  1742.       end; {case}
  1743.       HiLight(Table[CurrentTable]^.ITTT.CurrentField);
  1744.       with Table[CurrentTable]^ do
  1745.            with FieldDefn[ITTT.CurrentField]^ do
  1746.                 GotoXY(CursorX,Y);
  1747.       
  1748. {$IFDEF IOFULL}
  1749.       with Table[CurrentTable]^ do
  1750.            with FieldDefn[ITTT.CurrentField]^ do
  1751.            begin
  1752.                If  (FirstCharPress = false)
  1753.                and (Jump_Full)
  1754.                and (StrLocX = FieldLen)
  1755.                and (Length(FieldStr) = FieldLen)
  1756.                and (ITTT.Insert)
  1757.                and (K in [#32..#126])
  1758.                and (Jump_Full) then
  1759.                    Change_Fields(FieldDefn[ITTT.CurrentField]^.RightField);
  1760.            end;
  1761. {$ENDIF}
  1762.       If Table[CurrentTable]^.ITTT.CurrentField <> OldField then  {5.00l}
  1763.          FirstCharPress := true
  1764.       else
  1765.          FirstCharPress := false;
  1766.       I_Char := K;
  1767.   end;    {Proc Activity}
  1768.  
  1769.  
  1770. begin   {Process_Input}
  1771.     If not TableSet then
  1772.         IOTTT_Error(14,0.0);  {5.01}
  1773.     with Table[CurrentTable]^ do
  1774.     begin
  1775.         If ITTT.Displayed = false then Display_All_Fields;
  1776.         If StartField in [1..ITTT.TotalFields] then
  1777.            ITTT.CurrentField := StartField
  1778.         else
  1779.            StartField := 1;
  1780.         {Enter Field Hook}        {5.00m}
  1781.         SField := StartField;
  1782.         Finished := false;
  1783.         Repeat
  1784.              ITTT.CurrentField := SField;
  1785.              SRefresh := Refresh_None;
  1786.              {$IFDEF VER50}
  1787.              ITTT.EnterFieldHook(SField,SRefresh);
  1788.              {$ELSE}
  1789.              If IO_EnterHook <> Nil then
  1790.                 CallEnterFieldHook(SField,SRefresh);
  1791.              {$ENDIF}
  1792.              Check_Refresh_State(SRefresh);
  1793.              If Finished then exit;
  1794.         until SField = ITTT.CurrentField;
  1795.         Hilight(ITTT.CurrentField);
  1796.         If FieldDefn[ITTT.CurrentField]^.MsgX <= 80 then
  1797.         DisplayMessage(Table[CurrentTable]^.ITTT.CurrentField);
  1798.         GotoXY(FieldDefn[ITTT.CurrentField]^.CursorX,
  1799.                FieldDefn[ITTT.CurrentField]^.Y);
  1800.         FirstCharPress := true;
  1801.         {$IFDEF VER50}                          {5.00j}
  1802.         ITTT.InsertProc(ITTT.Insert);
  1803.         {$ELSE}
  1804.         If IO_InsertHook <> Nil then
  1805.            CallInsertHook(ITTT.Insert);
  1806.         {$ENDIF}
  1807.         repeat
  1808.              Activity;
  1809.         until Finished;
  1810.     end;
  1811. end;   {Process_Input}
  1812.  
  1813. begin  {Initial Auto proc}
  1814.     CurrentTable := 1;
  1815.     TableSet := False;
  1816. end.
  1817.  
  1818.